#pragma once

#include "DesignEntity.h"
#include "config.h"
#include <vector>
using namespace std;

class Node{
public:
	/** Constructor
	 * Create a new node with an allocated nodeID of a specific design entity that belongs to a specific statement number.
	 * @param nodeID the node ID
	 * @param designEntity the design entity of the new node.
	 * @param stmtNumber the statement number of which current node is located, -1 if no statement number (e.g. procedure node).
	 */
	Node(DesignEntity *designEntity, int stmtNumber = NOSTMTNUM);

	/**
	 * Set the nodeID of this node
	 * @return the nodeID
	 */
	int setNodeID(int nodeID);

	/**
	 * Get the nodeID of this node.
	 * @return the nodeID of this node.
	 */
	int getNodeID();

	/**
	 * Get the statement number that is linked to this node.
	 * @return the statement number that is linked to this node, can be -1.
	 */
	int getStmtNumber();

	/**
	 * Get the designEntity of this node.
	 * @return the designEntity of this node.
	 */
	DesignEntity* getDesignEntity();

	/**
	 * Append a child to the children list of this node, with the parent of the child set accordingly.
	 * @param childNode the child node to be added.
	 * @return true if added successfully, false if childNode is NULL.
	 */
	bool addChildNode(Node* childNode);

	/**
	 * Set the parent of this node.
	 * @param node the parent node to be set.
	 * @return true if added successfully, false if node is NULL.
	 */
	bool setParent(Node* node);

	/**
	 * Get the parent node of this node.
	 * @return the parent node of this node, can be NULL.
	 */
	Node* getParent();

	/**
	 * Get the children of this node
	 * @return the children of this node, can be empty.
	 */
	vector<Node*> getChildren();

	/**
	 * check if this Node is equal to the param (DE).
	 * @param the Node to be compared.
	 * @return true if this Node is equal to the param Node, return false otherwise.
	 */
	bool equals(Node* otherNode);

private:
	int nodeID; /**< the node ID of this node */
	int stmtNumber; /**< the statement number that is linked to this node */
	DesignEntity *designEntity; /**< the design entity of this node */
	Node *parent; /**< the parent of this node */
	vector<Node*> children; /**< the list of child nodes belong to this node */
};
